home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-13 | 1.2 KB | 73 lines | [TEXT/EDIT] |
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class TEST_ARRAY_ADD_LAST
-
- creation {ANY}
- make
-
- feature {ANY}
-
- t_boolean: ARRAY[BOOLEAN];
- t_integer: ARRAY[INTEGER];
- t_animal: ARRAY[ANIMAL];
- t_real: ARRAY[REAL];
- t_any: ARRAY[ANY];
-
- make is
- local
- i: INTEGER;
- cat: CAT;
- dog: DOG;
- do
- t_boolean := <<true>>;
- from
- i := 1;
- until
- i = 100
- loop
- i := i + 1;
- t_boolean.add_last(true);
- is_true(t_boolean.nb_occurrences(true) = i);
- end;
-
- t_integer := <<56>>;
- from
- i := 1;
- until
- i = 100
- loop
- i := i + 1;
- t_integer.add_last(56);
- is_true(t_integer.nb_occurrences(56) = i);
- end;
-
- !!cat;
- t_animal := <<cat>>;
- from
- i := 1;
- until
- i = 100
- loop
- i := i + 1;
- t_animal.add_last(cat);
- is_true(t_animal.nb_occurrences(cat) = i);
- end;
- end;
-
- is_true(b: BOOLEAN) is
- do
- cpt := cpt + 1;
- if not b then
- std_output.put_string("TEST_ARRAY_ADD_LAST: ERROR Test # ");
- std_output.put_integer(cpt);
- std_output.put_string("%N");
- else
- -- std_output.put_string("Yes%N");
- end;
- end;
-
- cpt: INTEGER;
-
- end -- TEST_ARRAY_ADD_LAST
-